﻿#region License
/* ---------------------------------------------------------------- *
 *
 * This file is part of the Xcoordination Application Space
 * ("XcoAppSpace") http://www.xcoordination.com
 *
 * Copyright (C) 2009 Xcoordination http://www.xcoordination.com
 *
 * XcoAppSpace is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General
 * Public License as published by the Free Software Foundation.
 *
 * XcoAppSpace is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/
 * or write to the Free Software Foundation, Inc., 51 Franklin
 * Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * ---------------------------------------------------------------- */
#endregion

using System;
using Microsoft.Ccr.Core;

namespace XcoAppSpaces.Contracts.Messaging
{
	/// <summary>
	/// Information about a causality
	/// </summary>
    [Serializable]
    public class CausalityInfo
    {
		/// <summary>
		/// The name of the causality.
		/// </summary>
        public string Name { get; set; }

		/// <summary>
		/// The exception port of the causality.
		/// </summary>
        public IPort ExceptionPort { get; set; }

		/// <summary>
		/// The coordinatio port of the causality.
		/// </summary>
        public IPort CoordinationPort { get; set; }

		/// <summary>
		/// Creates a new CausalityInfo.
		/// </summary>
		public CausalityInfo()
		{
		}

		/// <summary>
		/// Creates a new CausalityInfo.
		/// </summary>
		/// <param name="c">The causality from which the relevant information should be taken.</param>
        public CausalityInfo(ICausality c)
        {
            Name = c.Name;
            ExceptionPort = c.ExceptionPort;
            CoordinationPort = c.CoordinationPort;
        }

#if MF
        /// <summary>
        /// Initializes a new instance of the <see cref="CausalityInfo"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="exceptionPort">The exception port.</param>
        /// <param name="coordinationPort">The coordination port.</param>
        public CausalityInfo(string name, IPort exceptionPort, IPort coordinationPort)
        {
            Name = name;
            ExceptionPort = exceptionPort;
            CoordinationPort = coordinationPort;
        }
#endif
    }
}